<html>
<head>
<script>

function done() {
   if (window.testRunner) {
       testRunner.notifyDone();
   }
}

function elementRemover(doc, id) {
    return function() {
        var element = doc.getElementById(id);
        element.parentNode.removeChild(element);
        done();
    }
}

function navigateIFrameThenRemoveLink() {
    var iframe = document.getElementById('iframe');
    iframe.onload = elementRemover(iframe.contentDocument, 'prerenderLink');
    iframe.contentWindow.location = "resources/empty.html";
}

if (window.testRunner) {
    testRunner.waitUntilDone();
    testRunner.dumpAsText();
}
</script>
</head>
<body>
<h1>Test navigation and removal of link prerender elements</h1>

<iframe id=iframe onload="navigateIFrameThenRemoveLink()" src="resources/simple-prerender.html"></iframe><br>
This test succeeds when it does not crash.  The iframe above this text should also not crash, and should show an empty page.

</body>
</html>
